<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>Form 1042-S - IRS Publication 515  - Income Code - Country Code - Exemption Code - Non Resident Tax - Withholding Agent - International Payroll - F1,H1B,J1 Tax - Form W8BEN - Form 8233</title>
<link href="css/style.css" type="text/css" rel="stylesheet">

<!--Google Hosted Jquery Plugin -->

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>

<!-- Jquery Json Select Box Plugin -->
<script src="scripts/jquery_selectbox/jquery.selectboxes.js" type="text/javascript"></script>
<script type="text/javascript">
  
$(document).ready(function(){

	jQuery.getJSON("scripts/data/country_data.js",function(jsonData) {

		$.each(jsonData,function(key,object) {
		 $("#country").addOption(object.Country_Code,object.Country);
		 $("#country option[@value='select']").attr('selected', 'true');
		});
	});

    jQuery.getJSON("scripts/data/income_data.js",function(jsonData) {
		$.each(jsonData,function(key,object) {
	     $("#income_type").addOption(object.Income_Code,object.Income);
	           $("#income_type option[@value='select']").attr('selected', 'true');
        });
	});
    
    jQuery.getJSON("scripts/data/exemption_data.js",function(jsonData) {
		$.each(jsonData,function(key,object) {
          $("#exemption_type").addOption(object.Exemption_Code,object.Exemption);
          $("#exemption_type option[@value='select']").attr('selected', 'true');
		});
	});
   
    jQuery.getJSON("scripts/data/recipient_data.js",function(jsonData) {
      $.each(jsonData,function(key,object) {
        $("#recipient_type").addOption(object.Recipient_Code,object.Recipient);
        $("#recipient_type option[@value='select']").attr('selected', 'true');
      });
   });
   
   
  
       $("#country").change(function() {

                country_code_selected=$("#country").val();
                
                country_selected = $("#country option[@selected]").html();
                
                $("#selectedCountry").val(country_selected);
                $("#selectedCountryCode").val(country_code_selected);
                
        });        
        
        
          $("#income_type").change(function() {

                IncomeTypeSelected =$("#income_type").val();
                
                IncomeType = $("#income_type option[@selected]").html();
                
                $("#selectedincome_type").val(IncomeType);
                $("#selectedincome_code").val(IncomeTypeSelected);
                
        });        
        
            $("#exemption_type").change(function() {

                ExemptionTypeSelected =$("#exemption_type").val();
                
                ExemptionType = $("#exemption_type option[@selected]").html();
                
                $("#selectedexemption_type").val(ExemptionType);
                $("#selectedexemption_code").val(ExemptionTypeSelected);
                
        });        
        
        
          $("#recipient_type").change(function() {

                RecipientTypeSelected =$("#recipient_type").val();
                
                RecipientType = $("#recipient_type option[@selected]").html();
                
                $("#selectedrecipient_type").val(RecipientType);
                $("#selectedrecipient_code").val(RecipientTypeSelected);
                
        });        
});



    
</script>

</head>
<body>


<div id="content">

<form>
<table>
<tr><b>Form 1042-S Country and Country Code </b></tr>
<tr><td></br>Select Country&nbsp;&nbsp;<select id="country"/></td></tr>
<tr>
<!-- It is important to add IDs to the text fields to be able to address them easily with jQuery //-->
<td>
</br>
Selected Country : &nbsp;&nbsp;<input id="selectedCountry" type = "text" name="" value=""/> 
</td>
</tr>
<tr>
<td>
</br>
Selected CountryCode :&nbsp;&nbsp;<input id="selectedCountryCode" type =" text" name ="" value="" /> 
</td>
</tr>
<tr><td></br></br><b>Form 1042-S Income and Income Code </b></td></tr>
<tr><td></br>Select Income&nbsp;&nbsp;<select id="income_type"/></td></tr>
<tr>
<td>
</br>
Selected Income Type: &nbsp;&nbsp;<input id="selectedincome_type" type = "text" name="" value=""/> 
</td>
</tr>
<tr>
<td>
</br>
Selected Income Code :&nbsp;&nbsp;<input id="selectedincome_code" type =" text" name ="" value="" /> 
</td>
</tr>
<tr><td></br></br><b>Form 1042-S Exemption and Exemption Code </b></td></tr>
<tr><td></br>Select Exemption&nbsp;&nbsp;<select id="exemption_type"/></td></tr>
<tr>
<td>
</br>
Selected Exemption Type: &nbsp;&nbsp;<input id="selectedexemption_type" type = "text" name="" value=""/> 
</td>
</tr>
<tr>
<td>
</br>
Selected Exemption Code :&nbsp;&nbsp;<input id="selectedexemption_code" type =" text" name ="" value="" /> 
</td>
</tr>
<tr><td></br></br><b>Form 1042-S Recipient and Recipient Code </b></td></tr>
<tr><td></br>Select Recipient Type&nbsp;&nbsp;<select id="recipient_type"/></td></tr>
<tr>
<td>
</br>
Selected Recipient Type: &nbsp;&nbsp;<input id="selectedrecipient_type" type = "text" name="" value=""/> 
</td>
</tr>
<tr>
<td>
</br>
Selected Recipient Code :&nbsp;&nbsp;<input id="selectedrecipient_code" type =" text" name ="" value="" /> 
</td>
</tr>
</table>
</form>

</div>



</body>
</html>